<?php 
	class MapsController
	{
		private $model;
		function __construct($model)
		{
			$this->model=$model;
		}
		function save_location()
		{
			$latlgn=$_POST['latLng'];
			$image_ids=$_POST['image_ids'];
			$address=$_POST['address'];
			$image_ids_array=explode(';', $_POST['image_ids']);
			foreach($image_ids_array as $image_id )
				if($this->model->is_set_location($image_id))
					$this->model->update_location($image_id,$latlgn,$address);
				else 
					$this->model->save_location($image_id,$latlgn,$address);
		}
	}

 ?>